package cn.change360.newappchildrenenglish.adapter;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import cn.change360.newappchildrenenglish.R;
import cn.change360.newappchildrenenglish.mode.Columns;
import cn.change360.newappchildrenenglish.mode.Words;
import cn.change360.newappchildrenenglish.utils.FileUtil;

/**
 * Created by Jacky on 2015/10/22.
 */

public class CharactersAdapter extends BaseAdapter {

    private LayoutInflater mInflater;
    private List<Words> datas;
    private Context context;


    public CharactersAdapter(Context context, List<Words> datas) {
        this.mInflater = LayoutInflater.from(context);
        this.datas = datas;
        this.context = context;
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public Object getItem(int arg0) {
        return datas.get(arg0);
    }

    @Override
    public long getItemId(int arg0) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.adapter_characters, null);
            holder.charachers_title = (TextView) convertView.findViewById(R.id.charachers_title);
            holder.charachers_translation = (TextView) convertView.findViewById(R.id.charachers_translation);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.charachers_title.setText(datas.get(position).getWord_title()+ "");
        holder.charachers_translation.setText(datas.get(position).getWord_translation()+ "");
        return convertView;
    }

    public final class ViewHolder {
        public TextView charachers_title,charachers_translation;
    }
}